package com.yanqu.road.server.cmd.activity.deepfishing;

import com.yanqu.road.entity.activity.deepfishing.entity.DeepFishingFishingCheckPoint;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.DeepFishingProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.deepseafishing.DeepFishingModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_DEEP_FISHING_CHECK_POINT, desc = "赶海 挖东西")
public class DeepFishingFishingCheckPointCmd extends AbstractCommand {

    private long timeMill;
    private int deep;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DeepFishingProto.timerFishingCheckReqMsg timerFishingCheckReqMsg = DeepFishingProto.timerFishingCheckReqMsg.parseFrom(packet.getBytes());
        timeMill = timerFishingCheckReqMsg.getCurrentMill();
        deep = timerFishingCheckReqMsg.getDeep();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
//        ret =  player.getModule(DeepFishingModule.class).checkFishingProcess(new DeepFishingFishingCheckPoint(timeMill,deep));
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret != 0){
            DeepFishingProto.timerFishingCheckRespMsg.Builder builder = DeepFishingProto.timerFishingCheckRespMsg.newBuilder();
            builder.setRet(ret);
            player.sendPacket(ClientProtocol.U_DEEP_FISHING_CHECK_POINT,builder);
        }
    }
}
